package com.ytf.test.ninth;

class A {
    interface B {
        void f();
    }

    public class BImp implements B {
        @Override
        public void f() {

        }
    }

    private class BImp2 implements B {
        @Override
        public void f() {

        }
    }

    public interface C {
        void f();
    }

    public class CImp implements C {
        @Override
        public void f() {

        }
    }

    private class CImp2 implements C {
        @Override
        public void f() {

        }
    }

    private interface D {
        void f();
    }

    public class DImp implements D {
        @Override
        public void f() {

        }
    }

    private class DImp2 implements D {
        @Override
        public void f() {

        }
    }

    public D getD() {
        return new DImp();
    }

    private D dRef;

    public void receiveD(D d) {
        dRef = d;
        dRef.f();
    }
}

interface E{
    interface G{
        void f();
    }
    public interface H{
        void f();
    }
    void g();

    // Cannot be private within an interface;
    //! private interface I{}
}

/**
 * @author: YTF
 * @date: 2025/2/2 11:17
 * @version: 1.0
 * @description:
 */
public class NestingInterfaces {
    public class BImp implements A.B{
        @Override
        public void f() {

        }
    }
    class CImp implements A.C{
        @Override
        public void f() {

        }
    }
    /*!
    class DImp implements A.D{
        @Override
        public void f() {

        }
    }*/

    class EImp implements E{
        @Override
        public void g() {

        }
    }
    class EGImp implements E.G{
        @Override
        public void f() {

        }
    }
    class EImp2 implements E{
        @Override
        public void g() {

        }
        class EG implements E.G{
            @Override
            public void f() {

            }
        }
    }

    public static void main(String[] args) {
        A a = new A();
        //! A.D ad = a.getD();
        //! A.DImp di2= a.getD();
        //! a.getD().f();
        A a2 = new A();
        a2.receiveD(a.getD());
    }
}
